{"ast":null,"code":"import React from\"react\";import{Context}from\"../../index\";import{observer}from\"mobx-react-lite\";import{Alert,AlertTitle}from\"@mui/material\";import styles from'./Error.module.scss';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var Error=function Error(_ref){var _ref$text=_ref.text,text=_ref$text===void 0?'Неизвестная ошибка':_ref$text;var _React$useContext=React.useContext(Context),store=_React$useContext.store;if(store.getIsError()){return/*#__PURE__*/_jsxs(Alert,{className:styles.errorAlert,severity:\"error\",onClose:function onClose(){store.setIsError(false);},children:[/*#__PURE__*/_jsx(AlertTitle,{children:\"\\u0423\\u043F\\u0441, \\u0447\\u0442\\u043E-\\u0442\\u043E \\u043F\\u043E\\u0448\\u043B\\u043E \\u043D\\u0435 \\u0442\\u0430\\u043A...\"}),\"\\u041F\\u0440\\u0438\\u0447\\u0438\\u043D\\u0430 \\u043E\\u0448\\u0438\\u0431\\u043A\\u0438 \\u2014 \",/*#__PURE__*/_jsx(\"strong\",{children:text})]});}return/*#__PURE__*/_jsx(\"div\",{className:styles.disableError});};export default observer(Error);","map":{"version":3,"names":["React","Context","observer","Alert","AlertTitle","styles","Error","text","useContext","store","getIsError","errorAlert","setIsError","disableError"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/components/Error/index.tsx"],"sourcesContent":["import React from \"react\";\nimport {Context} from \"../../index\";\nimport {observer} from \"mobx-react-lite\";\nimport {Alert, AlertTitle} from \"@mui/material\";\nimport {AlertProps} from \"../../models/props/AlertProps\";\nimport styles from './Error.module.scss';\n\nconst Error: React.FC<AlertProps> = ({text = 'Неизвестная ошибка'}) => {\n    const {store} = React.useContext(Context);\n\n    if (store.getIsError()) {\n\n        return (\n            <Alert className={styles.errorAlert} severity=\"error\" onClose={() => {store.setIsError(false)}}>\n                <AlertTitle>Упс, что-то пошло не так...</AlertTitle>\n                Причина ошибки — <strong>{text}</strong>\n            </Alert>\n        );\n    }\n\n    return (\n        <div className={styles.disableError}></div>\n    );\n}\n\nexport default observer(Error);"],"mappings":"AAAA,MAAOA,MAAK,KAAM,OAAO,CACzB,OAAQC,OAAO,KAAO,aAAa,CACnC,OAAQC,QAAQ,KAAO,iBAAiB,CACxC,OAAQC,KAAK,CAAEC,UAAU,KAAO,eAAe,CAE/C,MAAOC,OAAM,KAAM,qBAAqB,CAAC,wFAEzC,GAAMC,MAA2B,CAAG,QAA9BA,MAA2B,MAAsC,oBAAjCC,IAAI,CAAJA,IAAI,oBAAG,oBAAoB,WAC7D,sBAAgBP,KAAK,CAACQ,UAAU,CAACP,OAAO,CAAC,CAAlCQ,KAAK,mBAALA,KAAK,CAEZ,GAAIA,KAAK,CAACC,UAAU,EAAE,CAAE,CAEpB,mBACI,MAAC,KAAK,EAAC,SAAS,CAAEL,MAAM,CAACM,UAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAE,kBAAM,CAACF,KAAK,CAACG,UAAU,CAAC,KAAK,CAAC,EAAE,wBAC3F,KAAC,UAAU,oIAAyC,wGACnC,wBAASL,IAAI,EAAU,GACpC,CAEhB,CAEA,mBACI,YAAK,SAAS,CAAEF,MAAM,CAACQ,YAAa,EAAO,CAEnD,CAAC,CAED,cAAeX,SAAQ,CAACI,KAAK,CAAC"},"metadata":{},"sourceType":"module"}